import { delToken, getToken, setToken } from '@/utils/storage'

export default {
  namespaced: true,
  state () {
    return {
      token: getToken()
    }
  },
  mutations: {
    setUserToken (state, token) {
      state.token = token
      // 存入本地
      setToken(token)
    },
    logout (state) {
      // 清除vuex中的token
      state.token = ''
      // 清除本地的toekn
      delToken()
    }
  }
}